import 'package:flutter/material.dart';
import 'package:uikit/utils/screen_util/size_extension.dart';

class AppBarWidget extends AppBar {
  AppBarWidget({
    Key? key,
    bool? centerTitle,
    double? titleSpacing,
    Widget? leading,
    Widget? title,
    List<Widget>? actions,
  }) : super(
          key: key,
          centerTitle: centerTitle,
          titleSpacing: titleSpacing,
          leading: leading,
          title: title,
          actions: actions,
        );

  factory AppBarWidget.normal({String? title, String? rightTitle, VoidCallback? rightButtonClick}) {
    return AppBarWidget(
      centerTitle: false,
      titleSpacing: 0,
      leading: const BackButton(),
      title: Text(
        title ?? "",
        style: TextStyle(fontSize: 18.sp),
      ),
      actions: [
        InkWell(
          onTap: rightButtonClick,
          child: Container(
            padding: EdgeInsets.only(left: 15.w, right: 15.w),
            alignment: Alignment.center,
            child: Text(
              rightTitle ?? "",
              style: TextStyle(fontSize: 18, color: Colors.grey[500]),
              textAlign: TextAlign.center,
            ),
          ),
        )
      ],
    );
  }
}
